home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-18 | 584 b | 25 lines |
- import vrml.*;
- import vrml.field.*;
- import vrml.node.*;
-
- public class AddRoute extends Script {
- private boolean routed = false;
- Browser b;
- Node lightswitch, dl;
-
- public void initialize () {
- b = getBrowser();
- dl = (Node)((SFNode)getField("dl")).getValue() ;
- lightswitch = (Node)((SFNode)getField("lightswitch")).getValue() ;
- }
-
- public void processEvent(Event e){
- if(routed) {
- b.deleteRoute(lightswitch, "isActive", dl , "on" );
- }else{
- b.addRoute(lightswitch, "isActive", dl, "on" );
- }
- routed = !routed;
- }
- }
-